# -*- coding: utf-8 -*-
"""
-------------------------------------------------
   File Name：     delete_file
   Description :
   Author :       'li'
   date：          2018/8/19
-------------------------------------------------
   Change Activity:
                   2018/8/19:
-------------------------------------------------
"""
import os
import shutil

from ml import list_file_paths_in_dir, create_dir


def delete_dir_and_tmp_images(dir_name):
    """
    delete dir and images
    :param dir_name:
    :return:
    """
    try:
        paths = list_file_paths_in_dir(dir_name)
        for p in paths:
            os.remove(p)
        os.removedirs(dir_name)
    except:
        pass


def main():
    dir_path = rf'C:\Users\marje\Desktop\箱顶洞照片\bbox - 副本'
    for i in range(100):
        try:
            shutil.rmtree(dir_path)
        except Exception as e:
            print(e)
    create_dir(dir_path)


if __name__ == '__main__':
    main()
